package cn.com.headfree.workflow.dao.impl;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import com.gta.edu.sdk.common.dto.Page;
import com.gta.edu.sdk.util.StringUtil;

import cn.com.headfree.entity.TEducateInfo;
import cn.com.headfree.entity.TEmpBaseInfo;
import cn.com.headfree.entity.TEmployeeMobility;
import cn.com.headfree.entity.TMouldInfo;
import cn.com.headfree.entity.TOrgDept;
import cn.com.headfree.entity.TProjAchieveInfo;
import cn.com.headfree.entity.TWorkFlow;
import cn.com.headfree.entity.TYearEffectInfo;
import cn.com.headfree.entity.isc.User;
import cn.com.headfree.vo.workflow.DbCount;
import cn.com.headfree.vo.workflow.HadDoListVo;
import cn.com.headfree.vo.workflow.WaitDoListVo;
import cn.com.headfree.workflow.dao.IWorkFlowDao;

@Repository("workFlowDao")
public class WorkFlowDaoImpl extends BaseDaoImpl<TOrgDept> implements IWorkFlowDao {

	@Override
	public List<TOrgDept> getDeptsByOrgId(User user) {
		String sql = "";
		sql = "select id,name,limit_start,limit_end,p_id,path,level from t_org_dept where 1=1 ";

		StringBuilder sqlbuilder = new StringBuilder(sql);

		ArrayList<Object> arrayList = new ArrayList<Object>();

		if (!StringUtil.isNullOrEmpty(user.getBaseOrgId())) {
			sqlbuilder.append(" AND p_id = ? ");
			arrayList.add(user.getBaseOrgId());
		}
		sqlbuilder.append(" order by level ");
		return this.findAllBySQL(TOrgDept.class, sqlbuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public void saveWorkFlowInfo(TWorkFlow tWorkFlow) {
		String sql = "insert into t_work_flow (id,business_id,primitive_id,business_type_id,deal_erp_no,deal_name,deal_opinion,arrive_time,deal_time,status,deal_role_code,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid) values ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{business_id,jdbcType=VARCHAR},")
				.append("#{primitive_id,jdbcType=VARCHAR},").append("#{business_type_id,jdbcType=VARCHAR},")
				.append("#{deal_erp_no,jdbcType=VARCHAR},").append("#{deal_name,jdbcType=VARCHAR},")
				.append("#{deal_opinion,jdbcType=VARCHAR},").append("#{arrive_time,jdbcType=DATE},")
				.append("#{deal_time,jdbcType=DATE},").append("#{status,jdbcType=VARCHAR},")
				.append("#{deal_role_code,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
				.append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
				.append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
				.append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
				.append("#{is_valid,jdbcType=INTEGER})");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", tWorkFlow.getId());
		params.put("business_id", tWorkFlow.getBusinessId());
		params.put("primitive_id", tWorkFlow.getPrimitiveId());
		params.put("business_type_id", tWorkFlow.getBusinessTypeId());
		params.put("deal_erp_no", tWorkFlow.getDealErpNo());
		params.put("deal_name", tWorkFlow.getDealName());
		params.put("deal_opinion", tWorkFlow.getDealOpinion());
		params.put("arrive_time", new Timestamp(new Date().getTime()));
		params.put("deal_time", tWorkFlow.getDealTime());
		params.put("status", tWorkFlow.getStatus());
		params.put("deal_role_code", tWorkFlow.getDealRoleCode());
		params.put("creater_id", tWorkFlow.getCreaterId());
		params.put("creater_name", tWorkFlow.getCreaterName());
		params.put("create_time", new Timestamp(new Date().getTime()));
		params.put("updater_id", tWorkFlow.getUpdaterId());
		params.put("updater_name", tWorkFlow.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("del_sign", tWorkFlow.getDelSign());
		params.put("is_valid", tWorkFlow.getIsValid());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void findWaitDoBaseInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,c.path,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_emp_base_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1 and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
//		sqlbuilder.append(" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_erp_no=? and status='0' order by n.arrive_time desc");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoYearEffectInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_year_effect_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1 and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoEducationInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_educate_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1 and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoContiStudyInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_conti_study_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1 and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoProTecInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_pro_tec_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1 and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoSkillLevelInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_skill_level_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1 and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoExpertTitleInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_expert_title_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoAcadeAchiveInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_acade_achive_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoStandInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_stand_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoPatentInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_patent_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoTecInnovInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_tec_innov_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoTecManInnovPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_tec_man_innov a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoHonorInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_honor_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoProjAchieveInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_proj_achieve_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoSdtTutorPrentInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_sdt_tutor_prent_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void findWaitDoWorkExpInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id ");
		sqlbuilder.append(" from t_work_exp_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void getHadDoListByCondition(Page<HadDoListVo> page, HadDoListVo hadDo) {

		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,n.deal_time,m.flow_status,m.tab_name,m.primitive_id from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,d.tab_name,GET_DIC('FlowAuditStatus',a.flow_status) as flow_status,a.primitive_id ");
		sqlbuilder.append(" from " + hadDo.getTabName() + " a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status!=0 ");
		if (!StringUtil.isNullOrEmpty(hadDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(hadDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(hadDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(hadDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(hadDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(hadDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(hadDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(hadDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where  n.del_sign=0 and n.deal_role_code in ("
						+ hadDo.getCurrentLoginRoleCode() + ")  and status='1' order by n.deal_time desc");
//		arrayList.add(hadDo.getCurrent);
		this.findPageBySql(HadDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void updateBaseInfoYes(TEmpBaseInfo baseInfo) {
		String sql = "UPDATE t_emp_base_info  SET";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		sqlBuilder.append(" erp_no=#{erp_no,jdbcType=VARCHAR},");
		sqlBuilder.append(" name=#{name,jdbcType=VARCHAR},");
		sqlBuilder.append(" sex=#{sex,jdbcType=VARCHAR},");
		sqlBuilder.append(" birth_date=#{birth_date,jdbcType=DATE},");
		sqlBuilder.append(" nation=#{nation,jdbcType=VARCHAR},");
		sqlBuilder.append(" birth_place=#{birth_place,jdbcType=VARCHAR},");
		sqlBuilder.append(" born_place=#{born_place,jdbcType=VARCHAR},");
		sqlBuilder.append(" politi_status=#{politi_status,jdbcType=VARCHAR},");
		sqlBuilder.append(" id_card_no=#{id_card_no,jdbcType=VARCHAR},");
		sqlBuilder.append(" mobile_phone=#{mobile_phone,jdbcType=VARCHAR},");
		sqlBuilder.append(" level=#{level,jdbcType=VARCHAR},");
		sqlBuilder.append(" salary_grade=#{salary_grade,jdbcType=VARCHAR},");
		sqlBuilder.append(" party_date=#{party_date,jdbcType=DATE},");
		sqlBuilder.append(" job_date=#{job_date,jdbcType=DATE},");
		sqlBuilder.append(" unit=#{unit,jdbcType=VARCHAR},");
		sqlBuilder.append(" dept=#{dept,jdbcType=VARCHAR},");
		sqlBuilder.append(" cur_post=#{cur_post,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" updater_id=#{updater_id,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" updater_name=#{updater_name,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" update_time=#{update_time,jdbcType=VARCHAR} ");
		sqlBuilder.append(" where 1=1 ");
		sqlBuilder.append(" and id = #{id,jdbcType=VARCHAR} ");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", baseInfo.getId());
		params.put("erp_no", baseInfo.getErpNo());
		params.put("name", baseInfo.getName());
		params.put("sex", baseInfo.getSex());
		params.put("birth_date", baseInfo.getBirthDate());
		params.put("nation", baseInfo.getNation());
		params.put("birth_place", baseInfo.getBirthPlace());
		params.put("born_place", baseInfo.getBornPlace());
		params.put("politi_status", baseInfo.getPolitiStatus());
		params.put("id_card_no", baseInfo.getIdCardNo());
		params.put("mobile_phone", baseInfo.getMobilePhone());
		params.put("level", baseInfo.getLevel());
		params.put("salary_grade", baseInfo.getSalaryGrade());
		params.put("party_date", baseInfo.getPartyDate());
		params.put("job_date", baseInfo.getJobDate());
		params.put("unit", baseInfo.getUnit());
		params.put("dept", baseInfo.getDept());
		params.put("cur_post", baseInfo.getCurPost());
		params.put("updater_id", baseInfo.getUpdaterId());
		params.put("updater_name", baseInfo.getUpdaterName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void examineBaseInfoYes(String businessId) {

	}

	@Override
	public void updateTableValidByBusinessId(String businessId, String erpNo, String userName, int isValid,
			String orignalId, Integer flowStatus, String tabName) {
		String sql = "UPDATE " + tabName + "  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		if (isValid == 0) {
			sqlBuilder.append(" is_valid=#{is_valid,jdbcType=INTEGER},");
			sqlBuilder.append(" updater_id=#{updater_id,jdbcType=VARCHAR},");
			sqlBuilder.append(" updater_name=#{updater_name,jdbcType=VARCHAR},");
			sqlBuilder.append(" update_time=#{update_time,jdbcType=DATE}, ");
			sqlBuilder.append(" flow_status=#{flow_status,jdbcType=INTEGER} ");
			sqlBuilder.append(" where id=#{id,jdbcType=VARCHAR} ");
			params.put("is_valid", isValid);
			params.put("updater_id", erpNo);
			params.put("updater_name", userName);
			params.put("update_time", new Timestamp(new Date().getTime()));
			params.put("flow_status", flowStatus);
			params.put("id", businessId);
		} else {
			sqlBuilder.append(" is_valid=#{is_valid,jdbcType=INTEGER},");
			sqlBuilder.append(" flow_status=#{flow_status,jdbcType=INTEGER} ");
			sqlBuilder.append(" where id=#{id,jdbcType=VARCHAR} ");
			params.put("is_valid", isValid);
			params.put("flow_status", flowStatus);
			params.put("id", orignalId);
		}
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void updateWorkFlow(String businessId, String dealOpinion) {
		String sql = "UPDATE t_work_flow  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" deal_opinion=#{deal_opinion,jdbcType=VARCHAR},");
		sqlBuilder.append(" deal_time=#{deal_time,jdbcType=DATE},");
		sqlBuilder.append(" status=#{status,jdbcType=VARCHAR} ");
		sqlBuilder.append(" where business_id=#{id,jdbcType=VARCHAR} ");
		params.put("deal_opinion", dealOpinion);
		params.put("deal_time", new Timestamp(new Date().getTime()));
		params.put("status", 1);
		params.put("id", businessId);
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void updateYearEffect(TYearEffectInfo yearEffectInfo, User user) {
		String sql = "UPDATE t_year_effect_info  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" user_name=#{user_name,jdbcType=VARCHAR},");
		sqlBuilder.append(" id_card_no=#{id_card_no,jdbcType=VARCHAR},");
		sqlBuilder.append(" rate_year_start=#{rate_year_start,jdbcType=DATE}, ");
		sqlBuilder.append(" rate_year_end=#{rate_year_end,jdbcType=DATE}, ");
		sqlBuilder.append(" rate_year=#{rate_year,jdbcType=INTEGER}, ");
		sqlBuilder.append(" perfor_grade=#{perfor_grade,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" resi_inte=#{resi_inte,jdbcType=DOUBLE}, ");
		sqlBuilder.append(" cur_inte=#{cur_inte,jdbcType=DOUBLE}, ");
		sqlBuilder.append(" is_valid=#{is_valid,jdbcType=INTEGER}, ");
		sqlBuilder.append(" flow_status=#{flow_status,jdbcType=INTEGER}, ");
		sqlBuilder.append(" updater_id=#{updater_id,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" updater_name=#{updater_name,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" update_time=#{update_time,jdbcType=DATE} ");
		sqlBuilder.append(" where id=#{id,jdbcType=VARCHAR} ");
		params.put("user_name", yearEffectInfo.getUserName());
		params.put("id_card_no", yearEffectInfo.getIdCardNo());
		params.put("rate_year_start", yearEffectInfo.getRateYearStart());
		params.put("rate_year_end", yearEffectInfo.getRateYearEnd());
		params.put("rate_year", yearEffectInfo.getRateYear());
		params.put("perfor_grade", yearEffectInfo.getPerforGrade());
		params.put("resi_inte", yearEffectInfo.getResiInte());
		params.put("cur_inte", yearEffectInfo.getCurInte());
		params.put("is_valid", yearEffectInfo.getIsValid());
		params.put("flow_status", yearEffectInfo.getFlowStatus());
		params.put("updater_id", user.getFax());
		params.put("updater_name", user.getUserName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("id", yearEffectInfo.getId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void updateEducateInfoYes(TEducateInfo educateInfo, User user) {
		String sql = "UPDATE t_educate_info  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" start_time=#{start_time,jdbcType=VARCHAR},");
		sqlBuilder.append(" end_time=#{end_time,jdbcType=VARCHAR},");
		sqlBuilder.append(" acqu_time=#{acqu_time,jdbcType=DATE}, ");
		sqlBuilder.append(" grad_school=#{grad_school,jdbcType=DATE}, ");
		sqlBuilder.append(" school_type=#{school_type,jdbcType=INTEGER}, ");
		sqlBuilder.append(" major=#{major,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" educ_name=#{educ_name,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" degree_name=#{degree_name,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" is_cont_educ=#{is_cont_educ,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" is_employ_educ=#{is_employ_educ,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" is_highest_educ=#{is_highest_educ,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" user_name=#{user_name,jdbcType=DOUBLE}, ");
		sqlBuilder.append(" id_card_no=#{id_card_no,jdbcType=DOUBLE}, ");
		sqlBuilder.append(" is_valid=#{is_valid,jdbcType=INTEGER}, ");
		sqlBuilder.append(" flow_status=#{flow_status,jdbcType=INTEGER}, ");
		sqlBuilder.append(" updater_id=#{updater_id,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" updater_name=#{updater_name,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" update_time=#{update_time,jdbcType=DATE} ");
		sqlBuilder.append(" where id=#{id,jdbcType=VARCHAR} ");

		params.put("start_time", educateInfo.getStartTime());
		params.put("end_time", educateInfo.getEndTime());
		params.put("acqu_time", educateInfo.getAcquTime());
		params.put("grad_school", educateInfo.getGradSchool());
		params.put("school_type", educateInfo.getSchoolType());
		params.put("major", educateInfo.getMajor());
		params.put("educ_name", educateInfo.getEducName());
		params.put("degree_name", educateInfo.getDegreeName());
		params.put("is_cont_educ", educateInfo.getIsContEduc());
		params.put("is_employ_educ", educateInfo.getIsEmployEduc());
		params.put("is_highest_educ", educateInfo.getIsHighestEduc());
		params.put("user_name", educateInfo.getUserName());
		params.put("id_card_no", educateInfo.getIdCardNo());
		params.put("is_valid", educateInfo.getIsValid());
		params.put("flow_status", educateInfo.getFlowStatus());
		params.put("updater_id", user.getFax());
		params.put("updater_name", user.getUserName());
		params.put("update_time", new Timestamp(new Date().getTime()));
		params.put("id", educateInfo.getId());
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public TMouldInfo getMouldNameById(String id) {
		StringBuilder sqlBuilder = new StringBuilder("select MOULD_NAME from t_mould_info where 1=1 and ID=?");
		return this.findUnique(TMouldInfo.class, sqlBuilder.toString(), new Object[] { id });
	}

	@Override
	public void updateTableFlowStatusByBusinessId(String businessId, int flowStatus, String tabName) {
		String sql = "UPDATE " + tabName + "  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" flow_status=#{flow_status,jdbcType=INTEGER} ");
		sqlBuilder.append(" where id=#{id,jdbcType=VARCHAR} ");
		params.put("flow_status", flowStatus);
		params.put("id", businessId);
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void findWaitDoContestInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id  from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id  ");
		sqlbuilder.append(" from t_contest_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public List<DbCount> getDbOrYbCountByBusinessType(String fax, String status) {
		ArrayList<Object> arrayList = new ArrayList<Object>();
		StringBuilder sqlBuilder = new StringBuilder("select * from (");
		sqlBuilder.append(
				"select  a.id as business_type_id,a.MOULD_NAME as business_type_name,count(*) as db_count,a.tab_name,a.sort  from t_mould_info a left join t_work_flow b ");
		sqlBuilder.append(" on a.id=b.business_type_id where  b.del_sign=0 and b.deal_role_code in (" + fax + ") ");
//		arrayList.add(fax);
		sqlBuilder.append(" and b.status=? ");
		arrayList.add(status);
		sqlBuilder.append(" group by business_type_id ) as a where a.db_count>0 order by sort");
		return this.findAllBySQL(DbCount.class, sqlBuilder.toString(), null, false, arrayList.toArray());
	}

	@Override
	public void updateWorkFlowDataByPrimitiveId(String primitiveId) {
		String sql = "UPDATE t_work_flow  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" del_sign=1 ");
		sqlBuilder.append(" where primitive_id=#{primitive_id,jdbcType=VARCHAR} ");
		params.put("primitive_id", primitiveId);
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void updateWorkFlow(String businessId, String dealOpinion, String erpNo, String userName) {
		String sql = "UPDATE t_work_flow  SET ";
		StringBuilder sqlBuilder = new StringBuilder(sql);
		Map<String, Object> params = new HashMap<String, Object>();
		sqlBuilder.append(" deal_opinion=#{deal_opinion,jdbcType=VARCHAR},");
		sqlBuilder.append(" deal_time=#{deal_time,jdbcType=DATE},");
		sqlBuilder.append(" status=#{status,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" deal_erp_no=#{deal_erp_no,jdbcType=VARCHAR}, ");
		sqlBuilder.append(" deal_name=#{deal_name,jdbcType=VARCHAR} ");
		sqlBuilder.append(" where business_id=#{id,jdbcType=VARCHAR} ");
		params.put("deal_opinion", dealOpinion);
		params.put("deal_time", new Timestamp(new Date().getTime()));
		params.put("status", 1);
		params.put("deal_erp_no", erpNo);
		params.put("deal_name", userName);
		params.put("id", businessId);
		this.executeSql(sqlBuilder.toString(), params);
	}

	@Override
	public void findWaitDoRotationInfoPageByCondition(Page<WaitDoListVo> page, WaitDoListVo waitDo) {
		StringBuilder sqlbuilder = new StringBuilder();
		ArrayList<Object> arrayList = new ArrayList<Object>();
		sqlbuilder.append(
				"select m.business_id,m.user_name,m.erp_no,m.dept_id,m.dept_name,m.mould_id,m.mould_name,m.deal_time,m.tab_name,m.primitive_id  from ");
		sqlbuilder.append(
				" (select a.id as business_id,a.isc_user_id,a.creater_name as user_name,a.creater_id as erp_no,c.id as dept_id,c.name as dept_name,a.business_type_id as mould_id,d.mould_name,a.create_time as deal_time,d.tab_name,a.primitive_id  ");
		sqlbuilder.append(" from t_rotation_info a ");
		sqlbuilder.append(" inner join t_dept_emp_rela b on a.creater_id=b.erp_no ");
		sqlbuilder.append(" inner join t_org_dept c on b.dept_id=c.id ");
		sqlbuilder.append(" inner join t_mould_info d on a.business_type_id=d.id where 1=1  and a.flow_status=0 ");
		if (!StringUtil.isNullOrEmpty(waitDo.getMouldId())) {
			sqlbuilder.append(" AND d.id=? ");
			arrayList.add(waitDo.getMouldId());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getUserName())) {
			sqlbuilder.append(" AND a.creater_name like concat('%',?,'%') ");
			arrayList.add(waitDo.getUserName());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getErpNo())) {
			sqlbuilder.append(" AND a.creater_id like concat('%',?,'%') ");
			arrayList.add(waitDo.getErpNo());
		}
		if (!StringUtil.isNullOrEmpty(waitDo.getDeptId())) {
			sqlbuilder.append(" AND c.path like concat('%',?,'%') ");
			arrayList.add(waitDo.getDeptId());
		}
		sqlbuilder.append(" ) as m ");
		sqlbuilder.append(
				" inner join t_work_flow n on m.business_id = n.business_id where n.del_sign=0 and n.deal_role_code in ("
						+ waitDo.getCurrentLoginRoleCode() + ") and status='0' order by n.arrive_time desc");
//		arrayList.add(waitDo.getCurrentLoginRoleCode());
		this.findPageBySql(WaitDoListVo.class, sqlbuilder.toString(), page, arrayList.toArray());
	}

	@Override
	public void updateTEmployeeMobility(TEmployeeMobility tEmployeeMobility, User user) {
		StringBuilder sqlBuilder = new StringBuilder("update t_employee_mobility set ");
		sqlBuilder.append("flow_mode = #{flow_mode,jdbcType=VARCHAR},")
				.append("flow_area = #{flow_area,jdbcType=VARCHAR},").append("flow_type = #{flow_type,jdbcType=VARCHAR},")
				.append("begin_time = #{begin_time,jdbcType=DATE},").append("end_time = #{end_time,jdbcType=DATE},")
				.append("updater_id = #{updater_id,jdbcType=VARCHAR},").append("updater_name = #{updater_name,jdbcType=VARCHAR},")
				.append("update_time = #{update_time,jdbcType=DATE} ").append("where id = #{id,jdbcType=VARCHAR}");
		HashMap<String, Object> params = new HashMap<>();
		params.put("flow_mode",tEmployeeMobility.getFlowMode());
		params.put("flow_area",tEmployeeMobility.getFlowArea());
		params.put("flow_type",tEmployeeMobility.getFlowType());
		params.put("begin_time",tEmployeeMobility.getBeginTime());
		params.put("end_time",tEmployeeMobility.getEndTime());
		params.put("updater_id",user.getFax());
		params.put("updater_name",user.getUserName());
		params.put("update_time",LocalDateTime.now());
		params.put("id",tEmployeeMobility.getId());
		this.executeSql(sqlBuilder.toString(), params);

	}

}
